﻿<%@ Page Language="C#" MasterPageFile="~/ClientSite.Master" AutoEventWireup="true"
    CodeBehind="GioHang.aspx.cs" Inherits="SES.CMS.GioHang" Title="Untitled Page" %>

<%@ Register Src="Module/ucTag.ascx" TagName="ucTag" TagPrefix="uc2" %>
<%@ Register Src="Module/ucLeftMenu.ascx" TagName="ucLeftMenu" TagPrefix="uc4" %>
<%@ Register Src="Module/ucRightMenu.ascx" TagName="ucRightMenu" TagPrefix="uc3" %>
<%@ Register Src="Module/ucBreadcrumb.ascx" TagName="ucBreadcrumb" TagPrefix="uc5" %>
<%@ Register Src="Module/ucHoTro.ascx" TagName="ucHoTro" TagPrefix="uc6" %>
<%@ Register Src="Module/ucShopInfo.ascx" TagName="ucShopInfo" TagPrefix="uc7" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div class="Style-2-Left">
        <uc4:ucLeftMenu ID="ucLeftMenu1" runat="server" />
        <uc7:ucShopInfo ID="ucShopInfo1" runat="server" />
        <uc6:ucHoTro ID="ucHoTro1" runat="server" />
    </div>
    <div class="Style-2-Right">
        <uc5:ucBreadcrumb runat="server" ID="brc1" />
        <div id="dProductDetail">
            <asp:UpdatePanel runat="server" UpdateMode="Conditional">
                <ContentTemplate>
                    <asp:Label ID="lbl" runat="server"></asp:Label>
                    <asp:GridView runat="server" ID="GridGioHang" AutoGenerateColumns="False" EmptyDataText="Không có dữ liệu !"
                        AllowPaging="True" OnPageIndexChanging="GridGioHang_PageIndexChanging" OnRowCommand="GridGioHang_RowCommand"
                        CellPadding="4" Width="730px" BorderColor="#CC9966" BorderStyle="None"
                        BorderWidth="1px" OnRowDataBound="GridGioHang_RowDataBound" DataKeyNames="STT"
                        OnDataBinding="GridGioHang_DataBinding" OnDataBound="GridGioHang_DataBound" CssClass="mGrid"
                        PagerStyle-CssClass="pgr" AlternatingRowStyle-CssClass="alt" RowStyle-CssClass="rgr"
                        HeaderStyle-CssClass="hgr">
                        <RowStyle />
                        <Columns>
                            <asp:TemplateField HeaderText="STT" ItemStyle-Width="13px">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lbSTT" Text="<%# Container.DataItemIndex + 1 %>">
                                    </asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                                <FooterTemplate>
                                    Tổng tiền:
                                </FooterTemplate>
                                <FooterStyle BorderColor="White" Font-Bold="true" ForeColor="Red" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Tên sản phẩm" ItemStyle-Width="180px">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="txtTen" Text='<%#DataBinder.Eval(Container.DataItem,"TenSanPham") %>'>
                                    </asp:Label>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Left" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Ảnh SP" ItemStyle-Width="65px">
                                <ItemTemplate>
                                    <a class="fackybox" href="/Media/<%#Eval("HinhAnh")%>" />
                                    <img src="/Media/<%#Eval("HinhAnh")%>" height="40px" width="64px" /></a>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Số Lượng" ItemStyle-Width="50px">
                                <ItemTemplate>
                                    <asp:TextBox runat="server" OnTextChanged="Calc" AutoPostBack="true" ID="txtSL" Width="20px"
                                        Text='<%#DataBinder.Eval(Container.DataItem,"SoLuong") %>'>
                                    </asp:TextBox>
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                                <FooterStyle BorderColor="White" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Đơn Giá" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="90px">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lbDG" Text='<%#DataBinder.Eval(Container.DataItem,"DonGia","{0:0,0 VNĐ}") %>'>
                                    </asp:Label>
                                </ItemTemplate>
                                <FooterStyle BorderColor="White" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Giảm Giá (%)" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="70px">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lbDGG" Text='<%#Eval("GiamGia") +"%" %>'>
                                    </asp:Label>
                                </ItemTemplate>
                                <FooterStyle BorderColor="White" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Thành Tiền" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="110px">
                                <ItemTemplate>
                                    <asp:Label runat="server" ID="lbThanhTien" Font-Bold="true" Text='<%#DataBinder.Eval(Container.DataItem,"ThanhTien","{0:0,0 VNĐ}") %>'>
                                    </asp:Label>
                                </ItemTemplate>
                                <FooterTemplate>
                                    <asp:Label ID="lbTong" runat="server" Font-Bold="true" ForeColor="Red"></asp:Label>
                                </FooterTemplate>
                                <FooterStyle HorizontalAlign="Center" BorderColor="White" />
                            </asp:TemplateField>
                            <asp:TemplateField HeaderText="Thao tác">
                                <ItemTemplate>
                                    <asp:ImageButton runat="server" ID="imgUpdate" CommandName="capnhat" ToolTip="Cập nhật số lượng"
                                        CommandArgument='<%#DataBinder.Eval(Container.DataItem,"STT") %>' ImageUrl="/images/update_quantity.png" />
                                    <asp:ImageButton runat="server" ID="img_xoa" CommandName="xoa" OnClientClick="return confirm('Bạn có muốn loại bỏ sản phẩm này ra khỏi giỏ hàng?')"
                                        CommandArgument='<%#DataBinder.Eval(Container.DataItem,"STT") %>' ImageUrl="/images/remove.png" />
                                </ItemTemplate>
                                <ItemStyle HorizontalAlign="Center" />
                                <FooterStyle BorderColor="White" />
                            </asp:TemplateField>
                        </Columns>
                        <FooterStyle />
                        <PagerStyle />
                        <SelectedRowStyle />
                        <HeaderStyle />
                    </asp:GridView>
                    <br />
                    <div style="width: 400px; margin-left: auto; margin-right: 10px; text-align: right;">
                        <asp:Label ID="lblSum" runat="server"></asp:Label><br />
                        <asp:Label ID="lbThanhTien" runat="server"></asp:Label>
                    </div>
                </ContentTemplate>
            </asp:UpdatePanel>
            <div align="center" style="margin-top: 10px;" class="ltr dGioHang">
                <a href="/Default.aspx" class="continue_link">Tiếp tục mua hàng</a>
                <asp:HyperLink runat="server" ID="lbThanhtoan" CssClass="checkout_link" Text="Gửi đơn hàng"
                    NavigateUrl="/ThanhToan.aspx"></asp:HyperLink>
                <div style="margin-top: 40px;">
                    <hr />
                    <div class="SP">
                        Sản phẩm bán chạy
                        <ul class="sanPham">
                            <asp:Repeater runat="server" ID="rpt">
                                <ItemTemplate>
                                    <li><a href='/SanPhamChiTiet/<%#Eval("SanPhamID")%>/<%#FriendlyUrl(Eval("TenSanPham").ToString())%>'>
                                        <img src='/Media/<%#Eval("HinhAnh")%>' title='<%#Eval("TenSanPham")%>' alt='<%#Eval("TenSanPham")%>'
                                            class="bear" />
                                        <p class="pSanPham">
                                            <span class="spanTenSanPham">
                                                <%#Eval("TenSanPham")%>
                                            </span>
                                        </p>
                                        <p class="pSanPham">
                                            <span class="spanDonGia">
                                                <%#(bool)(Int64.Parse(Eval("DonGia").ToString()) == 0) ? "Liên hệ" : Eval("DonGia", "{0:0,0} đ")%>
                                            </span>
                                        </p>
                                    </a></li>
                                </ItemTemplate>
                            </asp:Repeater>
                        </ul>
                        </ItemTemplate> </asp:Repeater>
                        <asp:Label runat="server" Text="" ID="lbThongbao"></asp:Label>
                    </div>
                    <div style="width: 100%; float: left; margin-top: 10px;">
                        <div style="float: left;">
                            <asp:ImageButton ID="cmdPrev" Visible="false" OnClick="cmdPrev_Click" runat="server"
                                ImageUrl="~/images/prevpage.png" /></div>
                        <div style="float: right;">
                            <asp:ImageButton ID="cmdNext" Visible="false" OnClick="cmdNext_Click" runat="server"
                                ImageUrl="~/images/nextpage.png" /></div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</asp:Content>
